1. /* ipow10.cpp by K.Tsuru */
  2. /**************************************
  3. It returns 10^n.
  4. It does not check 10^n < LONG_MAX.
  5. ***************************************/
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8. #include <limits.h>
  9. #include <cmath>
  10. #include "mathtp.h"
  11. long ipow10(int n){
  12. if(n<0) return 0;
  13. double r = dpow10(n);
  14. if(r > (double)LONG_MAX) {
  15. perror("ipow10(n) is too large.");
  16. exit(1);
  17. }
  18. return (long)r;
  19. }

ipow10.cpp : last modifiled at 2017/02/16 22:22:30(447 bytes)
created at 2016/04/11 11:17:20
The creation time of this html file is 2017/10/07 10:54:15 (Sat Oct 07 10:54:15 2017).